package test.db.table.mysql.type;

import test.db.table.Table;

/**
 * @author newbie
 * @since 0.1
 */
public enum PwAttachFileTable implements Table, ColumnType {
    SID(Column.sid),
    REFERENCE_KEY(Column.referenceKey),
    ATTACH_ORDER(Column.attachOrder),
    ORIGINAL_NAME(Column.originalName),
    FILE_NAME(Column.fileName),
    FILE_EXTENSION(Column.fileExtenstion),
    FILE_SIZE(Column.fileSize),
    FILE_DESC(Column.fileDesc),
    ATTACH_TYPE(Column.attachType),
    DOWNLOAD_CNT(Column.downloadCnt);
    
    private final Column column;
    private static final String TYPE_REFERENCE_KEY = "BIGINT(18)";
    private static final String TYPE_ATTACH_ORDER = "INT(2)";
    private static final String TYPE_ORIGINAL_NAME = "VARCHAR(255)";
    private static final String TYPE_FILE_NAME = "VARCHAR(255)";
    private static final String TYPE_FILE_EXTENSTION = "VARCHAR(12)";
    private static final String TYPE_FILE_SIZE = "INT(10)";
    private static final String TYPE_FILE_DESC = "VARCHAR(500)";
    private static final String TYPE_ATTACH_TYPE = "VARCHAR(12)";
    private static final String TYPE_DOWNLOAD_CNT = "INT(10)";

    PwAttachFileTable(Column column) {
        this.column = column;
    }
    
    private enum Column {
        sid {
            String getType() {
                return TYPE_SID;
            }
        },
        
        referenceKey {
            String getType() {
                return TYPE_REFERENCE_KEY;
            }
        },
        
        attachOrder {
            String getType() {
                return TYPE_ATTACH_ORDER;
            }
        },
        
        originalName {
        	String getType() {
        		return TYPE_ORIGINAL_NAME;
        	}
        },
        
        fileName {
            String getType() {
                return TYPE_FILE_NAME;
            }
        },
        
        fileExtenstion {
        	String getType() {
        		return TYPE_FILE_EXTENSTION;
        	}
        },
        
        fileSize {
            String getType() {
                return TYPE_FILE_SIZE;
            }
        },
        
        fileDesc {
        	String getType() {
        		return TYPE_FILE_DESC;
        	}
        },
        
        attachType {
            String getType() {
                return TYPE_ATTACH_TYPE;
            }
        },
        
        downloadCnt {
            String getType() {
                return TYPE_DOWNLOAD_CNT;
            }
        };
        
        abstract String getType();
    }
    
    public String getType() {
        return column.getType();
    }
    
    public void initData() throws Exception {
    }
}